home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: msg.tcl,v 1.3 1995/02/03 16:55:02 zibi Exp $
- #
- # Minimal test of messagebox the idea here is to display all the different
- # types at once with different options, like new lines, blank titles, etc.
- #
-
-
- source tools.tcl
-
- proc LabelText {parent label text} {
- VtLabel $parent.label -label $label
- set txt [VtText $parent.txt -value $text -verticalScrollBar 1\
- -rightSide FORM -rows 3]
-
- return $txt
- }
-
- proc mkDlog {cmd buts txt cbs} {
- set txt [VtGetValues $txt -value]
- set parent [keylget cbs widget]
-
- lappend cmd $parent.$cmd -message $txt
-
- foreach but $buts {
- if { [VtGetValues $but -value]} {
- set resource [VtGetValues $but -userData]
- lappend cmd $resource
- }
- }
-
- set dialog [eval $cmd]
- VtShow $dialog
- }
-
- set ap [VtOpen "msg"]
-
- set dlog [VtFormDialog $ap.dlog -okLabel Exit -okCallback QuitCB -help]
-
- set txt [LabelText $dlog "Message Title" "Default Text"]
-
- set rc [VtRowColumn $dlog.rc -leftSide FORM -below $txt -horizontal \
- -CHARM_topOffset 1]
-
- foreach but { { OK -ok } { Cancel -cancel } { Help -help } } {
- set name [lindex $but 0]
- set data [lindex $but 1]
- set b [VtToggleButton $rc.$name -value 1 -userData $data]
- lappend butRay $b
- }
-
- set dlogs "VtMessageDialog
- VtErrorDialog
- VtWarningDialog
- VtInformationDialog
- VtQuestionDialog
- VtWorkingDialog"
-
- set rcb [VtRowColumn $dlog.rcb -horizontal -packing COLUMN -numColumns 2\
- -MOTIF_topOffset 10]
-
- foreach but $dlogs {
- set b [list $butRay]
- VtPushButton $rcb.$but -callback "mkDlog $but $b $txt"
- }
-
- VtShowDialog $dlog
- VtMainLoop
-
-